home *** CD-ROM | disk | FTP | other *** search
/ Suzy B Software 2 / Suzy B Software CD-ROM 2 (1994).iso / finances / checkbal / checkbal.doc < prev    next >
Text File  |  1995-04-25  |  20KB  |  545 lines

  1.                                 William Blair
  2.                               2608 Adela Avenue
  3.                               Orlando, FL 32826
  4.                                (305) 277-6432
  5.  
  6.                            Check Balancer Program
  7.  
  8.  
  9.      I had my Atari 8-bit computer for four years, and one of the things I 
  10.   
  11. used it for most often was to balance my checkbook.  When I moved up to the 
  12.   
  13. 16-bit Atari's, I sold my 8-bitter, much to my later regret.  One of the 
  14.   
  15. things I missed most was the program that I had used in balancing my 
  16.   
  17. checkbook, especially since it made what usually was a tedious task into a 
  18.   
  19. simple process.
  20.   
  21.      It soon occurred to me, however, that the ST computer would be even 
  22.   
  23. better for that sort of thing.  The GEM interface would definitely make a 
  24.   
  25. program more user-friendly, and the speed-up in sorting and searching would 
  26.   
  27. certainly be a plus.  So I took it upon my self to write a checkbook 
  28.   
  29. balancing program of my own.  And this is what came from the effort.
  30.   
  31.      The program itself is written in Modula-2, a language designed by the 
  32.   
  33. same person who designed Pascal, Dr. Nickolas Worth.  It allows a great 
  34.   
  35. amount of modularity (hence the name) and enables fast development.  This is 
  36.   
  37. the first program that I have written on the ST computer, and the first time 
  38.   
  39. I have used Modula-2.  Still, I was able to finish the program in about 72 
  40.   
  41. man-hours.  This includes initial design, programming and debugging.  A very 
  42.   
  43. nice language, Modula-2.
  44.  
  45. A Note on Dialogs
  46.  
  47.      When entering dollar amounts into the program, you will find that 
  48.   
  49. leading zeros must be entered.  I realise that this can get irritating, 
  50.   
  51. however, I chose this method for two good reasons.  First of all, I wanted to 
  52.   
  53. use the TOS input routines for the dialogs, so that it would limit the type 
  54.   
  55. of characters to be entered, and would save me from having to write the input 
  56.   
  57. routine myself.  It is difficult to intercept the text entered in a dialog, 
  58.   
  59. and I wanted the only characters to be accepted for the amount input to be 
  60.   
  61. numbers.  Also, I was trying to save time in writing this program since I had 
  62.   
  63. a (self-imposed) deadline.  The second reason for using the TOS input 
  64.   
  65. handling routines is that I wanted to have the decimal point present in the 
  66.   
  67. input area because I thought it improved the look of the dialog.  It 
  68.   
  69. shouldn't cause too many problems.
  70.   
  71.      Also, all alphabetic information entered during the dialogs must be 
  72.   
  73. uppercase.  It data is entered in lowercase it won't show up on the screen 
  74.   
  75. and this could be confusing.  Just make sure that uppercase is enabled before 
  76.   
  77. entering data.
  78.   
  79. Using the Program
  80.  
  81.      The program was developed to allow the user to enter all withdrawals, 
  82.   
  83. deposits, and checks written on a bank account into a file.  The entries are 
  84.   
  85. placed in the file ordered on the date the transaction occurred.  The program 
  86.   
  87. allows the entries to be searched using a number of criteria, and also will 
  88.   
  89. assist in balancing the account.  These are described in more detail below.  
  90.   
  91. Note that no menu selections are enabled until a file has been loaded, or at 
  92.   
  93. least until a filename has been given and initial file data entered.
  94.  
  95.      This initial file information consists of the user's name, address, 
  96.   
  97. city, state, year, and current amount in bank account.  The name and address 
  98.   
  99. information isn't essential and doesn't have to be entered, but it improves 
  100.   
  101. the look of the program.  The current bank account balance must be entered, 
  102.   
  103. however.  Just get the amount from the last bank statement received.
  104.  
  105.      There is a limit on the greatest value that can be displayed in the 
  106.   
  107. dialogs.  This is $99999.99, or for negative numbers, $-9999.99.  This is 
  108.   
  109. because I only allowed seven characters for displaying the numbers in the 
  110.   
  111. dialogs.  This won't cause any problems for the most part, since few people 
  112.   
  113. have deposits or withdrawal amounts in those quantities.  However, if by some 
  114.   
  115. chance such a large number does occur, a message will appear stating that the 
  116.   
  117. number can't be displayed, and the program will continue.  Dispite the fact 
  118.   
  119. that the number isn't displayed, it is still valid in memory, and will be 
  120.   
  121. used in the calculations done.  
  122.   
  123. The File Menu
  124.  
  125.      This menu contains the file commands.  They are used to load, save, and 
  126.   
  127. delete a file, as well as quit the program.
  128.   
  129.      Load - This is about the only menu selection enabled when the program 
  130.   
  131. first comes up.  It is necessary during the first use of the program to use 
  132.   
  133. LOAD so that some program information can be entered.  When this is selected, 
  134.   
  135. the program checks to see if there is any valid data in memory.  If so, it 
  136.   
  137. asks the user if it is okay to delete the current data before loading a new 
  138.   
  139. file.  If the user selects YES, the program deletes the data.  Then the user 
  140.   
  141. will be asked for a filename using the standard GEM item selector.  Selecting 
  142.   
  143. CANCEL will abort the selection.  If a filename is entered, the program 
  144.   
  145. checks to see if the file exists.  If it does, the data is loaded into 
  146.   
  147. memory.  If not, this is when a dialog box will open that will ask for some 
  148.   
  149. initial data from the user as described above.  Clicking on the exit button 
  150.   
  151. will save the information within the program.
  152.   
  153.      Save - This command will save the data currently in memory, then will 
  154.   
  155. return to the program to allow further changes to be entered.
  156.   
  157.      Close - Like SAVE, this command will save the data currently in memory.  
  158.   
  159. However, it also deletes the data in memory to allow a new file to be loaded.
  160.   
  161.      Delete - This command allows a file to be deleted.  It asks for 
  162.   
  163. confirmation before executing.
  164.   
  165.      Quit - This command exits the program.
  166.  
  167. The Entry Menu
  168.  
  169.      This menu has the commands used to enter data about checks, withdrawals, 
  170.   
  171. and deposits into memory.  It uses dialogs to help speed things up as well as 
  172.   
  173. make entry easier. 
  174.   
  175.      Enter Checks - This command allows the user to enter checks.  It opens a 
  176.   
  177. dialog which looks similar to a check form, and allows entry of date, check 
  178.   
  179. number, payee, check amount, and a short memo line.  Clicking on the "Enter 
  180.   
  181. Check" button will enter the data into memory and allow a new check to be 
  182.   
  183. entered.  The check number will be automatically incremented each time.  
  184.   
  185. After all checks have been entered, clicking on the "Quit" button will exit 
  186.   
  187. the check form.
  188.   
  189.      Enter Withdrawals - This command allows the entering of all withdrawals 
  190.   
  191. that are not checks.  It allows entry of date, withdrawal amount and a short 
  192.   
  193. memo line.  As above, clicking on the "Enter Entry" button will enter the 
  194.   
  195. data into memory, while clicking on the "Quit" button will exit the form.
  196.   
  197.      Enter Deposits - This is similar to the "Enter Withdrawals" form but is 
  198.   
  199. used for deposits into a bank account.
  200.  
  201.      Make New Year File - This command is used at the end of the current year 
  202.   
  203. to build a file for the next year containing all the entries that hadn't been 
  204.   
  205. cancelled.  It also carries over the name, address, current balance, and 
  206.   
  207. increments the year.  This allows the user to avoid having to re-enter this 
  208.   
  209. information at the end of a year.  This command will delete the entries 
  210.   
  211. currently in memory during the search, so make sure any new entries have been 
  212.   
  213. saved before using it.  A message will come up to insure this has been done.
  214.  
  215.      Note that after the user exits a form, a dialog will come up showing the 
  216.   
  217. current balance left in the account after the checks, withdrawals, and 
  218.   
  219. deposits have been entered.  This dialog is exited by clicking on the "Okay" 
  220.   
  221. button.  If the current balance is too large to be displayed within the seven 
  222.   
  223. character limitation, an error dialog will come up instead.
  224.   
  225. The Search Menu
  226.   
  227.  
  228.      This menu allows the user to define parameters for searching and 
  229.   
  230. printing, and to search and print using those parameters. As noted above, all 
  231.   
  232. data must be entered in uppercase.
  233.   
  234.      Enter Parameters - This command opens a dialog that will allow the user 
  235.   
  236. to specify an number of search criteria.  These will allow searching and 
  237.   
  238. printing based on date, check number, payee (or substring thereof), amount, 
  239.   
  240. and memo (or substring thereof).  The data is checked for validity after the 
  241.   
  242. dialog is exited by clicking the "Okay" button.
  243.   
  244.      When the dialog first comes up, there will be default values for each of 
  245.   
  246. the search criteria.  If the user wishes to return to these default values 
  247.   
  248. after they have been modified, all that is necessary is to press the escape 
  249.   
  250. key for that entry.  When the dialog is exited, it will place the default 
  251.   
  252. values in any entry that it finds empty.  This is necessary for the payee and 
  253.   
  254. memo string searches since the default is "All", and this can't be entered 
  255.   
  256. from the keyboard since it contains lowercase letters.
  257.  
  258.      Search Entries - When this command is selected, the program will ask if 
  259.   
  260. the user wishes the include the withdrawal and deposit entries in the search.  
  261.   
  262. This is so a user that wishes to see data relating to checks only can do so.  
  263.   
  264. The program will then search the list of entries using the parameters 
  265.   
  266. specified in the above command.  A "Searching" message will show on the 
  267.   
  268. screen during the search process.  After all entries have been located that 
  269.   
  270. match the search criteria, a window will open to display the first entry.  To 
  271.   
  272. examine the entries, simply click the up and down arrows of the window, and 
  273.   
  274. the entries will be displayed one by one.  The search command can be exited 
  275.   
  276. by closing the window.
  277.   
  278.      Note that when the window is open the Options menu selections become 
  279.   
  280. enabled.  These will allow the entry in the window to be deleted, cancelled, 
  281.   
  282. or edited.  More information on how these are used can be found below.
  283.   
  284.      Print Entries - This command will print the list of entries that match 
  285.   
  286. the search parameters.  A "Searching" message will display during the search 
  287.   
  288. process, then the program will start printing the entries.  This is a simple 
  289.   
  290. routine that doesn't allow the print format to be modified.  It simply allows 
  291.   
  292. the user to make a printout of his entries for his records.
  293.   
  294.      The printing can be stopped any time by hitting any key.  This will stop 
  295.   
  296. the printing and return control to the program.  Also, if an error occurs 
  297.   
  298. with the printer, the program will stop and display an error message to the 
  299.   
  300. user.
  301.   
  302. The Review Menu
  303.  
  304.      This menu contains the commands that are used to balance the checkbook.  
  305.   
  306.      Review Entries - This command will open a window that will allow the 
  307.   
  308. user to review the entries in memory.  The entries can be displayed forward 
  309.   
  310. and backward as in the search window by clicking the up and down arrows of 
  311.   
  312. the window.  The entries can also be reviewed by clicking the left and right 
  313.   
  314. arrows of the window.  This will display the entry that begins the next 
  315.   
  316. month.  For example, if an entry for January is displayed in the window, 
  317.   
  318. clicking on the right arrow will skip over all entries until it finds the 
  319.   
  320. first entry of the next month, which is February.  If there is no entry for 
  321.   
  322. February, it will display the first entry for the month of March, and so on.  
  323.   
  324. This allows a speedy method of skipping to the end of the year, or jumping 
  325.   
  326. over many of entries at a time.
  327.   
  328.      As above, this command will enable the selections in the Options menu, 
  329.   
  330. and will allow the user to delete, cancel, or edit the entry currently 
  331.   
  332. displayed in the window.  The command is exited by closing the window.
  333.   
  334.      Figure Balance - This command will determine if the entries stored in 
  335.   
  336. memory, and the entries on the bank statement match.  It will first ask for 
  337.   
  338. the current balance that is shown on the bank statement.  Then it will 
  339.   
  340. display a dialog showing the following information: the bank statement 
  341.   
  342. balance, the amount of uncancelled withdrawals, the difference between the 
  343.   
  344. two (the subtotal), the amount of uncancelled deposits, the addition of the 
  345.   
  346. subtotal and the deposits (the calculated total), the program's current 
  347.   
  348. total, and the difference between the calculated total and the program's 
  349.   
  350. total.  This difference should be zero if the entries in the memory and the 
  351.   
  352. bank statement match.  If they do not match, the entries in memory are 
  353.   
  354. probably wrong, and should be compared with the bank statement to make sure 
  355.   
  356. the amounts are correct, and that all entries are present.  An error message 
  357.   
  358. will appear if the account is unbalanced.
  359.   
  360. The Options Menu
  361.  
  362.      This menu contains the commands the affect the entries that are 
  363.   
  364. displayed in the search and review windows.  They are disabled until the 
  365.   
  366. windows are opened.
  367.   
  368.      Delete Entry - This command will delete an entry from the list.  It will 
  369.   
  370. prompt for a verification before deleting, since once the entry is deleted it 
  371.   
  372. is gone forever.  If the last entry in memory is deleted, the display window 
  373.   
  374. will close since there are no more entries to display.
  375.   
  376.      Cancel Entry - This command will mark an entry as cancelled.  This means 
  377.   
  378. that the entry was found on the bank statement, and that the bank has taken 
  379.   
  380. it into account in calculating the balance on the statement.  Since the bank 
  381.   
  382. has taken it into account, the program must also, and this command tells it 
  383.   
  384. to do so.  However, an entry can be uncancelled by using the command a second 
  385.   
  386. time, so any errors in cancelling can be repaired.
  387.   
  388.      Edit Entry - This command allows the currently displayed entry to be 
  389.   
  390. edited.  A form will open displaying the current data and allowing the user 
  391.   
  392. to change it.  The form used is the same one used when the entry was first 
  393.   
  394. entered.  Clicking on the "Enter Entry" button will update the changes to 
  395.   
  396. memory, while clicking on the "Quit" button will ignore the changes.
  397.   
  398.      There is a difference between editing entries displayed in the search 
  399.   
  400. window, and editing entries displayed in the review window.  In the review 
  401.   
  402. window, when an entry has been edited and entered, the modified entry will be 
  403.   
  404. displayed in the window.  In the search window, the window will close after 
  405.   
  406. the entry has been edited.  This is because once an entry has been modified, 
  407.   
  408. there is a chance that it no longer follows the search criteria, and 
  409.   
  410. therefore should not be displayed.  The list of entries must be searched 
  411.   
  412. again to bring the window back.
  413.  
  414. Balancing the Checkbook
  415.   
  416.      As briefly describe above, this program will allow the user to balance 
  417.   
  418. his checkbook.  The method used to do this is rather simple.
  419.   
  420.      First, enter all of the transactions that occur during the month.  Then, 
  421.   
  422. when the bank statement arrives, go through the entries one by one, and check 
  423.   
  424. to see if they appear on the bank statement. If they do, then cancel the 
  425.   
  426. entries using the CANCEL command.  After all of the entries have been 
  427.   
  428. checked, select the FIGURE BALANCE command.  Enter the ending balance that is 
  429.   
  430. on the statement.  The program will show the various amounts used to 
  431.   
  432. determine if the entries in memory match the entries on the bank statement.  
  433.   
  434. If all goes well, they will match and the program will state that the account 
  435.   
  436. is balanced.  If there is an error, an error message will be displayed.
  437.   
  438.      If an error occurs, this usually means that one or more of the entries 
  439.   
  440. in memory have invalid amounts, or that an entry is missing.  It is possible 
  441.   
  442. that the error is with the bank statement, but this is highly unlikely.  The 
  443.   
  444. only thing that can be done is to review the entries, and check the amounts 
  445.   
  446. against the bank statement to insure they are correct.  This will usually 
  447.   
  448. solve the problem.
  449.   
  450. Program Design and Implementation
  451.  
  452.      The program listing is commented well enough so that the logic can be 
  453.   
  454. followed without much trouble.  However, there are some design considerations 
  455.   
  456. that were important to the development of the program that may be of some 
  457.   
  458. interest to other programmers, especially those unfamiliar with pointers or 
  459.   
  460. linked lists.
  461.   
  462.      When I first decided to write the program, I wanted to have the entry 
  463.   
  464. list sorted using the date.  One of the ways I could have done this is to 
  465.   
  466. have sorted the list after every entry.  This would become very time 
  467.   
  468. consuming, so it couldn't be used.  I also had a problem in that I didn't 
  469.   
  470. want to allocate a large amount of memory all at once to be used for the 
  471.   
  472. entries, because no matter how large I made the memory block, it would put a 
  473.   
  474. limiting factor on the amount of data that could be entered.  For these two 
  475.   
  476. reasons I decided to use a linked list using pointers for holding the data 
  477.   
  478. for the entries.  Since pointers were used to link the entries, the entries 
  479.   
  480. could be sorted after every data entry by simply inserting the entry into the 
  481.   
  482. correct place in the list, without having to move the locations of the other 
  483.   
  484. entries.  This structure also eliminated the need to allocate a large memory 
  485.   
  486. area, since I could allocate memory for each entry as it was needed, and 
  487.   
  488. deallocated it when the entry was deleted.  Thus the linked list structure 
  489.   
  490. was very useful for this implementation.
  491.   
  492.      For those programmers that aren't familiar with linked lists and 
  493.   
  494. pointers, the routines in the program can be very useful.  One of the 
  495.   
  496. convenient aspects of using pointers in data representations is that the 
  497.   
  498. algorithms for insertion and deletion into and from a linked list are 
  499.   
  500. standard, and don't have to be modified to be used in a new program.  The 
  501.   
  502. algorithms used in this program came from a data structures book, 
  503.   
  504. Fundamentals of Data Structures, by E. Horowitz and S. Sahni.  Except for 
  505.   
  506. some additional code unrelated to the linked list that I added, the 
  507.   
  508. algorithms are exactly as they appeared in the book.
  509.   
  510.      A linked list is also used for the search routine.  This is because I 
  511.   
  512. needed a fast and easy way to display the entries matching the search 
  513.   
  514. parameters.  Searching for the next entry every time an arrow was clicked 
  515.   
  516. would be too time consuming.  So I sacrificed some extra memory to generate a 
  517.   
  518. list of the entries that matched the parameters.  This list is built during 
  519.   
  520. the "Searching..." message, which is why it doesn't appear on the screen for 
  521.   
  522. very long if the entry list is small (doesn't take much time to search the 
  523.   
  524. entries).  Once the list is built, it is a simple matter of displaying them.  
  525.   
  526. After the search window is closed, the entries in the list are deleted, and 
  527.   
  528. the memory is freed.  By the way, this same procedure is used in the print 
  529.   
  530. routine.
  531.   
  532. That's It
  533.  
  534.      That pretty much covers the check balancer program.  I tried to put as 
  535.   
  536. much error checking as I could, as well as spending time trying to make sure 
  537.   
  538. everything worked the way it was supposed to work.  Hopefully no serious bugs 
  539.   
  540. are hiding in it.  I hope you enjoy using it.
  541.   
  542.   
  543.   
  544.  
  545.